<f:subview
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:c="http://java.sun.com/jstl/core"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:a4j="http://richfaces.org/a4j"
  xmlns:nxl="http://nuxeo.org/nxforms/layout"
  xmlns:nxu="http://nuxeo.org/nxweb/util"
  id="#{layout.id}">

  <c:set var="isEditMode" value="#{nxl:isBoundToEditMode(layout.mode)}" />
  <nxu:set var="layoutWidgetsDisplay"
    value="#{layout.properties.widgetsDisplay}"
    resolveTwice="true">

    <table class="#{nxu:joinRender('dataInput', layoutProperty_styleClass)}">
      <tbody>

        <nxl:layoutRow>
          <nxu:set var="rowStyleClass"
            value="#{layoutRow.properties.styleClass}"
            resolveTwice="true">
            <tr class="#{rowStyleClass}">
              <nxl:layoutRowWidget>

                <c:if test="#{layoutWidgetsDisplay == 'label_top'}">
                  <nxu:set var="fieldColspan"
                    value="#{layout.columns/layoutRow.size}">
                    <td class="fieldColumn" colspan="#{fieldColspan}" dir="auto">
                      <c:if test="#{not widget.handlingLabels}">
                        <div>
                          <ui:include src="/widgets/incl/widget_label_template.xhtml">
                            <ui:param name="labelStyleClass"
                              value="boldLabel #{widgetProperty_subLabelStyleClass}" />
                          </ui:include>
                        </div>
                      </c:if>
                      <nxu:form id="#{widget.id}_form"
                        skip="#{!widgetControl_requireSurroundingForm}"
                        useAjaxForm="#{widgetControl_useAjaxForm}"
                        disableMultipartForm="#{widgetControl_disableMultipartForm}"
                        onsubmit="#{onFormSubmit}"
                        disableDoubleClickShield="#{widgetControl_disableDoubleClickShield}">
                        <nxl:widget widget="#{widget}" value="#{value}" />
                      </nxu:form>
                    </td>
                  </nxu:set>
                </c:if>

                <c:if test="#{layoutWidgetsDisplay != 'label_top'}">
                  <c:if test="#{layoutWidgetsDisplay != 'no_label'}">
                    <c:if test="#{not widget.handlingLabels}">
                      <td class="labelColumn">
                        <ui:include src="/widgets/incl/widget_label_template.xhtml" />
                      </td>
                    </c:if>
                  </c:if>
                  <nxu:set var="fieldColspan"
                    value="#{2*layout.columns/layoutRow.size -1 + nxu:test(widget.handlingLabels, 1, 0)}">
                    <td class="fieldColumn" colspan="#{fieldColspan}" dir="auto">
                      <nxu:form id="#{widget.id}_form"
                        skip="#{!widgetControl_requireSurroundingForm}"
                        useAjaxForm="#{widgetControl_useAjaxForm}"
                        disableMultipartForm="#{widgetControl_disableMultipartForm}"
                        onsubmit="#{onFormSubmit}"
                        disableDoubleClickShield="#{widgetControl_disableDoubleClickShield}">
                        <nxl:widget widget="#{widget}" value="#{value}" />
                      </nxu:form>
                    </td>
                  </nxu:set>
                </c:if>

              </nxl:layoutRowWidget>
            </tr>
          </nxu:set>
        </nxl:layoutRow>

      </tbody>
    </table>

  </nxu:set>

</f:subview>